4
4
.
.
4
4
.
.
2
2
R
R
e
e
c
c
t
t
a
a
n
n
g
g
l
l
e
e
I
I
n
n
f
f
o
o
[
[
R
R
]
]
This tutorials shows how to add View in the shape of the Rectangle.
You can't combine fill and stroke on the same Rectangle.
Fill
struct ContentView : View {
var body : some View {
Rectangle()
.rotation(.degrees(45))
.fill(Color.green)
.frame(width: 30, height: 30)
}
}
Stroke
struct ContentView : View {
var body : some View {
Rectangle()
.rotation(.degrees(45))
.stroke(Color.green, lineWidth: 2)
.frame(width: 30, height: 30)
}
}
Fill Stroke